package com.ldf.callback;

import com.aizuda.zlm4j.structure.MK_PS_DECODER;
import com.ldf.core.HCNetSDK;
import com.sun.jna.Pointer;
import com.sun.jna.ptr.ByteByReference;

import java.io.IOException;

import static com.ldf.RealPlayDemo.ZLM_API;


public class FRealDataCallbackForPsEncode implements HCNetSDK.FRealDataCallBack_V30 {
    private MK_PS_DECODER mkPsDecoder;

    public FRealDataCallbackForPsEncode(MK_PS_DECODER mkPsDecoder) {
        this.mkPsDecoder = mkPsDecoder;
    }

    @Override
    public void invoke(long lRealHandle, int dwDataType, ByteByReference pBuffer, int dwBufSize, Pointer pUser) throws IOException {
        ZLM_API.mk_ps_decoder_input(mkPsDecoder, pBuffer.getPointer(), dwBufSize);
    }

    /**
     * 关闭解析器
     */
    public void release() {
        ZLM_API.mk_ps_decoder_release(mkPsDecoder);
    }

}